//
//  SettingSwitchCell.swift
//  DoShare
//
//  Created by 1 on 2018/5/4.
//  Copyright © 2018年 eetrust. All rights reserved.
//

import UIKit

let kSettingSwitchCell: String = "SettingSwitchCell"

class SettingSwitchCell: RoundCornerCell {
    
    @IBOutlet var titleLabel: UILabel!
    @IBOutlet var theSwitch: UISwitch!
    
    var model: SettingSwitchCellModel? {
        didSet {
            titleLabel.text = model?.title
            theSwitch.isOn = model?.switchValue ?? false
        }
    }
    
    @IBAction func clickSwitch(_ sender: UISwitch) {
        if let block = model?.switchResult {
            block(sender.isOn)
        }
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
        selectionStyle = .none
        titleLabel.font = kSettingCellTitleFont
    }
}
